Skip to content

feat(recipes): per-recipe variables with machine override values - #28

Merged
mad01 merged 1 commit into
mainfrom
feat/recipe-override-vars
Jul 19, 2026
Merged

feat(recipes): per-recipe variables with machine override values#28
mad01 merged 1 commit into
mainfrom
feat/recipe-override-vars

Conversation

@mad01

@mad01 mad01 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Recipes can declare variables with defaults under [recipe.vars] and reference them as {{vars.<name>}} in shell alias/function names, alias commands, and function bodies. Machines set values through the existing override key: [recipes_config.overrides."<source>/<recipe>"] vars = { alias_name = "del" } (directory name for local recipes).

  • Expansion runs in processRecipeRef before MergeRecipeIntoConfig, so expanded names take part in duplicate detection and shell-name validation.
  • Overriding an undeclared variable and referencing an undeclared placeholder are both hard errors, so typos fail the run instead of generating a half-expanded function name.
  • Scope is deliberately shell items only (aliases + functions); other recipe sections don't see variables.
  • Docs: new "Recipe variables" section in docs/recipes.md, override field in docs/configuration.md.

First consumer: the thismoon toss-bin recipe, so a machine can rename its rm wrapper without disabling the recipe. Includes a small amount of pre-existing golines drift picked up by make format (cmd_apply.go and three test files).

Recipes declare defaults under [recipe.vars] and reference them as
{{vars.<name>}} in shell alias/function names, alias commands, and
function bodies. Machines set values via the existing override key:
[recipes_config.overrides."<source>/<recipe>"] vars = { name = "value" }.

Expansion runs in processRecipeRef before MergeRecipeIntoConfig, so
expanded names take part in duplicate detection and shell-name
validation. Overriding an undeclared variable and referencing an
undeclared placeholder are both hard errors.
@mad01
mad01 merged commit cd7a913 into main Jul 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant